#include "dominion.h"  
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>

#include <stdlib.h>

#include "rngs.h"

#define DEBUG 0
#define NOISY_TEST 1

char *k[] = {"adventurer", "estate", "duchy", "province", "copper", "silver", "gold", "adventurer", "council_room", "feast", "gardens", "mine", "remodel", "smithy", "village", "baron", "great_hall", "minion", "steward", "tribute", "ambassador", "cutpurse", "embargo", "outpost", "salvager", "sea_hag", "treasure_map"};



int check_getCost(int i, char *cardKind){

  // printf("cardKind = %s\n",cardKind);
  
  if(strcmp(cardKind,"curse")==0){
	assert(getCost(i)==0);
  }else if(strcmp(cardKind,"estate")==0){
	assert(getCost(i)==2);
  }else if(strcmp(cardKind,"duchy")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"province")==0){
	assert(getCost(i)==8);
  }else if(strcmp(cardKind,"copper")==0){
	assert(getCost(i)==0);
  }else if(strcmp(cardKind,"silver")==0){
	assert(getCost(i)==3);
  }else if(strcmp(cardKind,"gold")==0){
	assert(getCost(i)==6);
  }else if(strcmp(cardKind,"adventurer")==0){
	assert(getCost(i)==0 || getCost(i)==6);
  }else if(strcmp(cardKind,"council_room")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"feast")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"gardens")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"mine")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"remodel")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"smithy")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"village")==0){
	assert(getCost(i)==3);
  }else if(strcmp(cardKind,"baron")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"great_hall")==0){
	assert(getCost(i)==3);
  }else if(strcmp(cardKind,"minion")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"steward")==0){
	assert(getCost(i)==3);
  }else if(strcmp(cardKind,"tribute")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"ambassador")==0){
	assert(getCost(i)==3);
  }else if(strcmp(cardKind,"cutpurse")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"embargo")==0){
	assert(getCost(i)==2);
  }else if(strcmp(cardKind,"outpost")==0){
	assert(getCost(i)==5);
  }else if(strcmp(cardKind,"salvager")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"sea_hag")==0){
	assert(getCost(i)==4);
  }else if(strcmp(cardKind,"treasure_map")==0){
	assert(getCost(i)==4);
  }
  
}

int main () {
  
  printf ("Testing getCost.\n");
  
  int n, i;
  char *cardKind;
  
  for (n = 0; n < 5000; n++) {
    // printf("n = %d\n",n);
	i = floor(Random() * 27);
	// printf("i = %d\n",i);
	
	cardKind = k[i];
	// printf("cardKind = %s\n",cardKind);

	check_getCost(i, cardKind);

  }

  printf ("ALL TESTS OK\n");

  exit(0);

  return 0;
}
